<?php
require("../includes/config.inc.php"); 
require("../includes/Database.class.php"); 
require("../includes/GPSFunction.php"); 

$db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); 
$db->connect(); 

		$getDevice = "select * from tb_client_subscription";
		$resDevice = $db->query($getDevice);
		$date_offline = date('d-m-Y');
		if($db->affected_rows > 0)
		{	
			while($fetDevice = $db->fetch_array($resDevice))
			{
				$renewDate = date("d-m-Y",strtotime("-1 days ".($fetDevice[tcs_noOfMonths]) ."months ".$fetDevice[tcs_renewalDateFrom]));
				$cdata["tcs_renewalDateTo"] = date("Y-m-d",strtotime($renewDate));
				$db->query_update("tb_client_subscription", $cdata, "tcs_id = ".$fetDevice[tcs_id]);
			}
			
		}
?>